package com.shop2cn.iapi.sqoptrade.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

public class AddSellerMemoCall extends YmatouBaseCall {
	
	private static String opurl = "api/shenQiOrder/addSellerMemo";

	public AddSellerMemoCall() {
//		super(EnvSetup.getSystemUrl("operate2_iapi"), opurl, "POST", "JSON");
		super(EnvSetup.getSystemUrl("sqoptrade_iapi"), opurl, "POST", "JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getCode() {
		String Code = null;
		try {

			Code = new JSONObject(getReturnData()).getString("errorCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取success
	 * 
	 * @return
	 */
	public boolean getSuccess() {
		boolean success = false;
		try {
			success = new JSONObject(getReturnData()).optBoolean("success");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return success;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String BCode = null;
		try {
			BCode = new JSONObject(getReturnData()).getString("errorMessage");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}
}
